package l.l.w.practice.校招全国统一模拟笔试第五场编程题集合2017年.彩色瓷砖;

/**
 * Created by llw on 2017/10/12.
 */
import java.util.Scanner;
public class Main {
    public static int countReplaceColors (String str) {
        if (str == null)
            return 0;
        int count = 0;
        char[] color = new char[]{'R','G','B','Y'};
        char[] colorArr = str.toCharArray();
        for (int i = 0; i < colorArr.length-1; i++) {
            if (colorArr[i] == colorArr[i+1]) {
                if (i + 2 < colorArr.length) {
                    for (int j = 0; j < color.length; j++) {
                        if (colorArr[i] != color[j] && colorArr[i + 2] != color[j]) {
                            colorArr[i + 1] = color[j];
                            break;
                        }
                    }
                }
                i++;
                count ++;
            }
        }
        return count;
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        int res = countReplaceColors(str);
        System.out.println(res);
    }
}